<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    //结合解构赋值, port 可以设置默认值
    function connect({host, username, password, port = 3306}) {
        console.log(host)
        console.log(username)
        console.log(password)
        console.log(port)
    }

    const obj = {
        host: "localhost",
        username: "root",
        password: "root"
    }
    connect(obj)

</script>
</body>
</html>
